package models

import (
	"docker/conf"
	"fmt"
	"github.com/go-redis/redis"
)

var (
	Rdb *redis.Client
)

func RedisInit() {
	AppCond := conf.Conf.RedisConfig
	Rdb = redis.NewClient(&redis.Options{
		Addr:     AppCond.Addr,
		Password: AppCond.Password,
		DB:       AppCond.Db,
	})
	err = Rdb.Ping().Err()
	if err != nil {
		fmt.Println("连接失败-redis")
		return
	} else {
		fmt.Println("连接成功-redis")
	}
}
